#include "../../include/device/device.hpp"

namespace SoftEngine{
    MyMatrix::MyMatrix(XMFLOAT3 line31,XMFLOAT3 line32,XMFLOAT3 line33):line31(line31),line32(line32),line33(line33){
        this->isThreeDimensional=true;    
    }
    MyMatrix::MyMatrix(XMFLOAT4 line41,XMFLOAT4 line42,XMFLOAT4 line43,XMFLOAT4 line44):line41(line41),line42(line42),line43(line43),line44(line44){
        this->isThreeDimensional=false;
    }
    XMFLOAT3 MyMatrix::operator* (XMFLOAT3 dot){
        if (this->isThreeDimensional){
            return XMFLOAT3(
                dot.x*line31.x+dot.y*line31.y+dot.z*line31.z,
                dot.x*line32.x+dot.y*line32.y+dot.z*line32.z,
                dot.x*line33.x+dot.y*line33.y+dot.z*line33.z
            );
        }else{
            throw "This is a four dimensional matrix";
            return XMFLOAT3(0.0f,0.0f,0.0f);
        }
    }
    XMFLOAT4 MyMatrix::operator* (XMFLOAT4 dot){
        if (!this->isThreeDimensional){
            return XMFLOAT4(
                dot.x*line41.x+dot.y*line41.y+dot.z*line41.z+dot.w*line41.w,
                dot.x*line42.x+dot.y*line42.y+dot.z*line42.z+dot.w*line42.w,
                dot.x*line43.x+dot.y*line43.y+dot.z*line43.z+dot.w*line43.w,
                dot.x*line44.x+dot.y*line44.y+dot.z*line44.z+dot.w*line44.w
            );
        }else{
            throw "This is a three dimensional matrix";
            return XMFLOAT4(0.0f,0.0f,0.0f,0.0f);
        }
    }

}